<?php

/*

Club Members (club_members.php)

*/

$page_title = "Club Members";
$rank_check = 1;
include "header.inc.php";
$clubrank_check = 0;
$page_heading = "Members";
include "club.inc.php";

print "$openHTML$startClub";

if (!$start) { $start = 0; }
$max = 20;
$max2 = $start + $max;

$findMemberList = mysql_query("SELECT * FROM club_members2 WHERE game = '$game' AND club = '$clubid' ORDER BY posts DESC LIMIT $start,$max");
$findMemberList2 = mysql_query("SELECT * FROM club_members2 WHERE game = '$game' AND club = '$clubid'");
$numMembers = mysql_num_rows($findMemberList2);
while ($getMemberList = mysql_fetch_array($findMemberList))
{
	$members_info = fetch("SELECT * FROM members2 WHERE id = '$getMemberList[user]' AND game = '$game'");
	$members_profiles = fetch("SELECT * FROM members_profiles2 WHERE username = '$members_info[username]' AND game = '$game'");
	$getMemberList[dateregistered] = date("M j, Y", $getMemberList[dateregistered]);

	$memberID = $members_info[id];

	if ($members_profiles[gender] == 2) { $gender = "<img src=images/icons/male.gif>"; }
	if ($members_profiles[gender] == 1) { $gender = "<img src=images/icons/female.gif>"; }
	if ($members_profiles[gender] == 0) { $gender = "<img src=images/icons/undecided.gif>"; }

	$bud[$memberID] = "<a href=buds.php?game=$game&bud=$members_profiles[username]><img src=images/icons/bud.gif></a>";

	if ($getMemberList[position] == 2) { $clubRankStatus[$memberID] = " <font color=#3399FF size=-1>(Moderator)</font>"; }
	if ($getMemberList[position] == 3) { $clubRankStatus[$memberID] = " <font color=#0000FF size=-1>(Admin)</font>"; }


	$memberList .= "<tr><td valign=right><a href=user_profile.php?game=$game&user=$members_profiles[username]>$members_info[display_name]</a></td>
<td width=70>$getMemberList[posts]</td>
<td width=130>$getMemberList[dateregistered]</td>
<td width=14>$gender</td>
<td width=14>$bud[$memberID]</td>
<td>$clubRankStatus[$memberID]</td></tr>";

}

print "<center>
<table>
<tr><td colspan=6><p align=center><b><font size=+2>-- List Members -- </b></font></td></tr>
<tr><td valign=right><b>User</b></td>
<td width=70><b>Posts</b></td>
<td width=130><b>Registered</b></td>
<td width=14></td>
<td width=14></td>
<td><b>Rank</b></td></tr>

$memberList</table>
</center>";

if (($numMembers > $max) AND ($start < ($numMembers - $max)))
{
	echo "<p align=center><a href=$base_url/club_members.php?game=$game&start=$max2&clubid=$clubid>Next page</a></p>";
}
if ($start != 0)
{
	$prev_min = $start - $max;
	echo "<p align=center><a href=$base_url/club_members.php?game=$game&start=$prev_min&clubid=$clubid>Previous page</a></p>";
}

print "$endClub$closeHTML";

?>